package 剑指offer;

/**
 * @author zhangjunfei
 * @date 2023/7/20 15:46
 */
public class O_48 {
    public int lengthOfLongestSubstring(String s) {
        int result = 0;
        int i = 0, j = i;
        String temp = "";
        for (;i < s.length(); i++) {
            if (temp.contains(s.charAt(i) + "")) {
                temp = temp.substring(0, result);
                result--;
            } else {
                temp += s.charAt(i);
                result++;
            }
        }
        return result;
    }
}
